home *** CD-ROM | disk | FTP | other *** search
-
- #include <types.h>
- #include <memory.h>
- #include <quickdraw.h>
- #include <window.h>
- #include <print.h>
- #include <qdaux.h>
- #include <font.h>
- #include "hp.h"
-
- extern int MyID;
-
- GrafPortPtr WindowToPrint = NIL;
-
- handle PrintRecord = NIL;
-
- GrafPortPtr PrintPort;
-
- /* Coose Printer Item handler */
-
- DoChooserItem()
- {
- PrChooser();
- }
-
- /* Routine to handle page setup item */
-
- DoSetUpItem()
- {
- if (!(PrintRecord))
- SetUpDefault();
- PrStlDialog(PrintRecord);
- }
-
- /* routine to create default print record */
-
- SetUpDefault()
- {
- PrintRecord = NewHandle(140L,MyID,0x8010,0L);
- PrDefault(PrintRecord);
- }
-
- /* Now the menu item "Print" item */
-
- DoPrintItem()
- {
- if (WindowToPrint = FrontWindow()) /* is there a window to print? */
- {
- if (!(PrintRecord))
- SetUpDefault();
- if (PrJobDialog(PrintRecord))
- {
- WaitCursor();
- PrintPort = PrOpenDoc(PrintRecord,0L);
- PrOpenPage(PrintPort,0L);
- DrawTopWindow();
- PrClosePage(PrintPort);
- PrCloseDoc(PrintPort);
- PrPicFile(PrintRecord,0L,0L);
- InitCursor();
- }
- }
- }
-
- DrawTopWindow()
- {
-
- DataRecHandle TheRefCon = NIL; /* we use slightly different */
- DataRecPtr auxPtr; /* structures for pictures */
-
- FDataRecHandle FontHandle; /* and for fonts */
- FDataRecPtr FontPtr;
-
- TheRefCon = (DataRecHandle)GetWRefCon(WindowToPrint);
- HLock(TheRefCon);
- auxPtr = *TheRefCon;
- if (auxPtr -> Flag) /* non_zero --> font */
- {
- FontHandle = (FDataRecHandle)GetWRefCon(WindowToPrint); /* again */
- HLock(FontHandle); /* to pass */
- FontPtr = *FontHandle; /* the right */
- ShowFont(FontPtr -> FID,FontPtr); /* stuff */
- HUnlock(FontHandle);
- }
- else /* Picture Window */
- PaintIt(auxPtr -> PicHand);
- HUnlock(TheRefCon);
- }
-